Click Here!



home account info subscribe login search FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Bug Proofing Visual Basic: A Guide to Error Handling and Prevention
(Publisher: John Wiley & Sons, Inc.)
Author(s): Rod Stephens
ISBN: 0471323519
Publication Date: 11/01/98

Search this book:
 
Previous Table of Contents Next


INDEX

A
abbreviations, variable name, 44–45, 121–122
actions, simulating user, 292–295, 297–298
ActiveX controls, 202, 245–247
algorithms, optimizing, 215–216
Allow Unrounded Floating-Point operations option, 222–223
& operator, 107
And operator, 107–108
APE (Application Performance Explorer), 304
API declarations, 210
arguments
default values and, 80–81
name issues, 82–83
variable promotion and, 165–166
verification of, 73–77
arrays
assumptions, verifying, 180–181
bounds of, 111–112, 220
constants and, 62–64
enumerated values and, 62–64
LBound function and, 65–66, 86–89, 180
UBound function and, 65–66, 86–89, 180
variants and, 52–53
Assume No Aliasing option, 219–220
assumptions, verifying array, 180–181
attitudes, programming, 3–16, 283
automatic reference counting, 151–152, 197
automatic result verification, 96–97
automatic variable declaration, 37–38
B
Bad1 example code, 15–16, 329–333
Bad10 example code, 211–213, 366–371
Bad11 example code, 224–225, 371–373
Bad12 example code, 249–251, 373–379
Bad13 example code, 272–274, 379–383
Bad15 example code, 311–312, 383–384
Bad16 example code, 324–326, 385–386
Bad3 example code, 58–59, 334–338
Bad4 example code, 69–71, 338–341
Bad5 example code, 97–99, 341–346
Bad6 example code, 124–126, 347–351
Bad8 example code, 167–169, 355–359
Bad9 example code, 189–193, 359–366
.BAS modules, 130, 199
black box testing method, 278, 281
blank lines, adding to code, 178–180
Boolean operators, 107–108
Break in Class Module option, 248
Break on All Errors option, 248
Break on Unhandled Errors option, 248
break options, Visual Basic, 248
bug logs, 20–21
ByRef keyword
parameter declarations, 114–115, 186–187
raising errors with, 181–182
ByVal keyword
parameter declarations, 114–115, 186–187
raising errors with, 181–182
C
capitalization, variable name, 45
Case Else causes, 68
CBool conversion function, 108
CInt conversion function, 108
circular references, 151–152
Class_Initialize event handler, 196–197
Class_Terminate event handler, 196–197
classes
encapsulation of, 195–196
event handlers and, 196–197, 198
Implements keyword and, 200–201
RoutineInfo, 260
validation of, 93
variants and, 52–53
.CLS modules, 130
code
arrays. See arrays
comment files, 129–143, 387–389
constants, 61–71, 75–77, 238
controls, 117, 202, 245–247, 256
conversion functions, 108
data types. See data types
debug and nondebug, separating, 187–188
duplicate, 204, 209–210
encapsulation of, 195–214
enhancements, addition of, 174–175
enumerated values, 61–71
error handling. See error handling
errors in
documentation of, 298–299
estimating finding time, 282, 296–297
estimating number of, 295–296
faking during testing, 290
example code. See example program code
fixing own, 292
format of
indentations, 178–180
line continuation, 116–117
parentheses, 108
spacing, 110–111
syntax, 157
invalid, error notification of, 84–85
keyboard shortcuts, 289
offensive vs. defensive, 11–12
operators, correct use of, 107–108
order of actions in, 119–120
parameters. See parameters
prepackaged tools and, 175–177
profiling with VBCP, 221–222, 303–313
analyzing results of, 307–311
checking code coverage, 295
debugging habits and, 315–327
instructions for, 306–307
optimization and, 216–217
self-test, 311–312, 384–386
random behavior in, 117–119
restrictions, adding, 85–86
review process, 278, 280–281, 290–292
side effects, 103–105
standardization of, 33–34
testing of, 277–302
anticipating results of, 290
black box method, 278, 281
code review method, 278, 280–281
code step through method, 278, 279–280
of dummy routines, 297–298
input checking method, 278, 281
code, testing of (Continued)
planning, 283
scope issues, 278–279
self-tests, 300–301, 382–383
stack trace messages, 258–265
user actions, simulating, 292–295, 297–298
white box method, 278, 282
writing routines for, 283–284
tricks in, 101–103
uniformity and simplicity of, 173–174, 175
validation of
application results, 96–97
arguments, 73–77
classes, 93
data, 89–93
forms, 93
optional parameters, 78–80
ParamArray, 83–84
variables. See variables
variants and, 36, 50–53, 54–55
wizards for, 120–121
Code Profiler, Visual Basic (VBCP), 303–313
analyzing results of, 307–311
checking code coverage, 295
installation of, 303–304
instructions for, 306–307
methodology of, 305
optimization and, 216–217
code review test method, 278, 280–281
code step through test method, 278, 279–280
code wizards, 120–121
: (command separator), 110–111
commands, spacing of, 110–111
comment files, 129–143
contents of, 130–134
context of, 137
debugging, adding during, 317–318
deletion of, 139
for event handlers, 136–137, 391
for functions, 134–136, 390–391
operating system compatibility, 138
optimizations, adding to, 217–218
for routines, 134–136, 390–391
self-test, 141–142, 350–354
style of communication in, 138–139
templates for, 135–136, 137, 387–389
text formatting in, 139–140
Common Dialog Control, 182
constants, 61–68, 69–71
adding to code, 67–68
arrays and, 63–64
Bad4 example code, 69–71, 339–342
DEBUG_MODE, 75–77
defining error, 238
deletion of, 67–68
grouping of, 69
MAX, 64–65
naming issues, 66–67
NUM, 64–65
control arrays. See also arrays
LBound function and, 65–66, 86–89
UBound function and, 65–66, 86–89
control type prefixes, 41, 42, 43
Control variables, 48
controls
ActiveX, 202, 245–247
default properties, 117
error events, catching with, 256
conversion functions, 108
copyright information, 130
Ctrl-F9 shortcut, 289
D
daily schedule, sample, 333–334
data types
Hungarian notation and, 41
mixing of, 105–106
nonspecific, 49–50
selecting, 48–49
user-defined (UDTs), 201–202
variants and, 50–55
data validation, 89–93
in classes, 93
in forms, 93
at shutdown, 90–91
at startup, 90–91
subroutine structure and, 89–90
while running, 92–93
databases, saving errors in, 267–270
date loops, 149–150
DBErr program, 268
DEBUG_MODE variable, 75–77
Debug.Assert statements, 74–75, 88, 180, 181
debugger, Visual Basic, 279–280
debugging code, 187–188. See also code
anticipating test results, 290
black box method, 278, 281
code review method, 278, 280–281
code step through method, 278, 279–280
compatibility issues, 285–286
with dummy routines, 297–298
errors
analysis and documentation of, 298–299
estimating finding time of, 296–297
estimating numbers of, 295–296
faking during testing, 290
fixing own, 316–317
global variables and, 282
input checking method, 278, 281
optimization and, 218
planning tests, 283
scope issues, 278–279
self-test example, 300–301
successful habits for, 315–327
test routines, writing, 283–284
user actions, simulating, 292–295, 297–298
white box method, 278, 282
declarations. See also names
encapsulation of, 210
listing in headers, 131–132
variable, 36, 37–38, 48–49
DefBool statements, 39
DefInt statements, 39
DefLng statements, 39
Deftype statements, 33, 39–40
dependencies in comment files, 130–131
descriptions in comment files, 130
design issues, 173–193
assumptions, verifying, 180–181
Bad9 example program, 189–193, 358–365
code uniformity and simplicity, 173–174, 175
debug and nondebug code, separating, 187–188
decision making process, 185
features, adding additional, 174–175
FreeFile and, 185–186
invalid situations and errors, 181–183
multipurpose variables and, 183–184
optimization of design and, 177–178
prepackaged tools and, 175–177
status codes and, 182
tasks, separation of, 184–185
text of code, 178–180
development process
Bad1 example program, 15–16, 329–333
catching bugs early in, 5
coding, designing before, 24–29
distractions during, 30–31
documentation methods, 19–21, 22–23
maintaining control during, 5–7
optimization, deferring, 9–10
prioritizing tasks, 5–9
testing during, 279
Dim statements, 113–114
dimension arrays. See arrays
distractions during programming, 30–31
division by zero, 165, 221–222
documentation methods, 19–21, 22–23
DoEvents statements, 90–91
dummy routines, testing, 297–298
duplicate code, 204, 209–210
E
email, error notification by, 270–272
Else statements, 68, 95–96
encapsulation, 195–214
ActiveX controls and, 202
Bad10 example code, 211–213, 366–371
of classes, 196
of errors, 205–206
Implements keyword and, 200–201
modules and, 203
objects and, 196–197, 198
property procedures and, 198–199
property values and, 207–208
repeating code and, 209–210
With statements, 208–209
subroutines and, 203–204
tracking interactions in, 195–196
user-defined types (UDTs), 201–202
variables and, 206–207
End statements, 155–156
End Function, 231, 235
End Property, 231, 235
End Sub, 231, 235
enhancements, adding additional, 174–175
entry points, listing in header, 130–131
enumerated values, 61–71
adding, 67–68
Bad4 example program, 69–71, 339–342
debugging example, 69–71
defining, 68–69
defining status codes with, 182
dimension arrays and, 63–64
grouping, 69
naming protocols, 66–67
removing, 67–68
enums. See enumerated values
equality tests, 145–148
error codes, 166–167, 238
error handling, 227–251, 253–274. See also errors
array bounds checks, 220
Bad12 example code, 249–251, 373–379
Bad13 example code, 272–273, 378–382
break options, Visual Basic, 248
bugproofing of, 241–242
cleaning up after errors, 243–245
controls and, 256
e-mail, error notification by, 270–272
error constants, defining, 238
error messages, presenting, 256–258
Err.Raise statements, 181, 231, 235–238
exiting from, 163
GoTo statements, 159–160
header comments and, 135
invalid code notification, 84–85
nesting of handlers, 240–241
normal execution, return to, 231–238
objects and, 245–247
On Error statements, 229–231
optimizations, Visual Basic, 218–224
saving errors to
databases, 267–270
files, 265–267
scope issues, 240
separation of handlers, 239
stack tracing of errors, 258–265
systematic use of handlers, 254–255
unexpected errors and, 242–243
error messages, 256–258
errors
analysis and documentation, 20–21, 298–299
catching with controls, 256
cleaning up after, 243–245
encapsulation of, 205–206
estimating finding time, 296–297
estimating numbers of, 295–296
faking during testing, 290
notification of by e-mail, 270–272
overflow, 164–165
raising for exceptions, 181–182
saving to
databases, 267–270
files, 265–267
stack tracing of, 258–265
underflow, 164–165
Err.Raise statements, 181, 231, 235–238
event handlers. See also error handling
Class_Initialize, 196–197
Class_Terminate, 196–197
comment files for, 136–137
Initialize, 198
objects and error handling, 245–247
unexpected errors and, 242–243
user actions, simulating, 292–295
events, user
simulating during testing, 292–295
testing user interface, 297–298
example program code
Bad1, 15–16, 329–333
Bad10, 211–213, 366–371
Bad11, 224–225, 371–373
Bad12, 249–251, 373–379
Bad13, 272–274, 379–383
Bad15, 311–312, 383–384
Bad16, 324–326, 385–386
Bad3, 58–59, 334–338
Bad4, 69–71, 338–341
Bad5, 97–99, 341–346
Bad6, 124–126, 346–350
Bad8, 167–169, 355–358
Bad9, 189–193, 358–365
exceptions, raising errors for, 181–182
exhaustive input checking test method, 278, 281
Exit statements, 155–156, 185
Exit Function, 231, 234–235
Exit Property, 231, 234–235
Exit Sub, 161–162, 231, 234–235
F
FDIV bug, 223–224
features, adding additional, 174–175
file names, 130
FileErr program, 265–267
files
opening and closing, 109–110
saving errors to, 265–267
float loops, 147–148
floating-point calculations
error checks, 221–222
unrounded operations, 222–223
For loops, 147–150, 289
Form variables, 48
format, code
indentations, 178–180
line continuation, 116–117
parentheses, 108
spacing, 110–111
forms
default properties, 117
defining, 55–58
loading and unloading of, 152–154
validation of, 93
variants and, 52–53
FreeFile, 185–186
.FRM modules, 130
Function Hit Count VBCP statistics, 306, 310–311
function return types, 49
Function Timing VBCP statistics, 306, 309
functions
header comments for, 134–136, 388–389
LBound, 65–66
Left$, 109
UBound, 65–66
verification of values in, 155–156
functions, variant subtype, 54–55
G
global variables, 47, 282
GoTo statements, 157–161
error handling and, 159–160
improper use of, 157–158
loops and, 160–161
granularities, testing at different, 278–279
H
header comments, 129–143
adding to during debugging, 317–318
contents of, 130–134
context of, 137
deletion of, 139
for event handlers, 136–137, 389
for functions, 134–136, 388–389
operating system compatibility, 138
optimizations and, 217–218
for routines, 134–136, 390–391
style of communication in, 138–139
templates for, 135–136, 137, 387–389
text formatting in, 139–140
Hungarian notation, 40–44
I
If statements, 75–77, 119–120, 185, 289
If Then Else statements, 68, 185
IIF statements, 163–164
Immediate window
modifying variables in, 288
testing subroutines within, 286
viewing variables in, 286–288
Implements keyword, 200–201
implicit variable creation, 37–38
incorrect arguments
Debug.Assert statements, 74–75
Stop command, 75–77
verification and, 73–77
indentation, adding to code, 178–180
inequality tests, 145–148
Initialize event handler, 198
input checking test method, 278, 281
input variables, 183–184
Instant Watch button, 286
integers
checking equality of, 145–147
controlling float loops with, 148
correct use of, 107–108
overflow errors and, 221
IsMissing function, 78–80
K
keyboard shortcuts, 289
L
LBound function, 65–66, 86–89, 180
Left$ function, 109
library declarations, 210
Line Hit Count VBCP statistics, 306, 309–310
Line Timing VBCP statistics, 306, 307–308
lines
adding blank to code, 178–180
continuation characters, 116–117
debugging habits and, 319
loops, 122–124
For, 147–150, 289
date, 149–150
decision making by, 185, 289
float, 147–148
GoTo statements and, 160–161
reference, 151–152
resizing inside of, 150–151
While, 148, 149–150, 289
M
magic numbers, 61–63
MailErr program, 270–272
MakeErrorMessage function, 256–257
management issues, 3–4
Bad1 example code, 15–16
control issues, 5–7
designing before coding, 24–29
documentation methods, 19–21, 22–23
optimization, deferring, 9–10
prioritizing tasks, 5–9
MAPIMessages controls, 270
MAPISession controls, 270
MAX constant, 64–65
mental discipline
during debugging, 315–316
during programming, 29–31
messages, error, 256–258
methods, listing in headers, 131–132
Microsoft Common Dialog Control, 182
Mod operator, 88
module-global variables, 46, 47, 282
modules, encapsulation with, 203
multiple variables, 36, 45–46
MyForm templates, 55–58
N
names
of constants, 66–67
of enumerated values, 66–67
of optional parameters, 82–83
of variables, 40–46, 121–124
abbreviations and, 44–45, 121–122
avoiding conflicts, 45–46
capitalization of, 45
Hungarian notation and, 40–44
use of meaningful, 44–45, 121–122
nested error handlers, 240–241
nested statements, 208–209
Next statements, 123–124
nondebug code, 187–188
nonspecific data types, 49–50
notebooks, using during development, 19–20
NUM constant, 64–65, 87
O
Object variables, 48, 49
objects
error handling and, 245–247
system-global, 282
tracking creation/destruction of, 196–197
On Error GoTo line statements, 229, 231
On Error GoTo statements, 159–160, 185
On Error Resume Next statements, 229, 230
one form, defining, 55–58
operating systems
comment files and, 138
testing code among multiple, 285–286
operators
&, 107
+, 107
Boolean, 107–108
Mod, 88
optimizations, 177–178, 215–225
algorithms and, 215–216
Bad11 example code, 224–225
comment files, adding to, 217–218
deferring in development process, 9–10
profiling and, 216–217
Visual Basic options, 218–224
Option Explicit statements, 37–38
optional parameters
avoidance of, 81–82
default values and, 80–81
naming issues, 82–83
validation of, 78–80
Or operator, 107–108
output variables, 184, 290
overflow errors, 164–165, 221
P
ParamArray parameters, 83–84
parameters
ByRef keyword, 114–115
ByVal keyword, 114–115
multipurpose, 184
notification of invalid, 84–85
optional, 78–83
ParamArray, 83–84
routine side effects, 103–105
parentheses ( ), 108
Pentium FDIV bug, 223–224
+ operator, 107
precision, integer, 145–147
prefix characters, 40–44
control type, 41, 42, 43
data type, 41
scope, 40, 41
prepackaged programming tools, 175–176
PrintTextAt subroutine, 82
prioritizing tasks, 5–9, 22–23
Private statements, 113–114
procedures
in header comments, 134–136
property return, 49, 198–199
profiling code. See Visual Basic Code Profiler (VBCP)
programming
ActiveX controls, 202, 245–247
arguments
arguments, verifying, 73–77
default values and, 80–83
variable promotion and, 165–166
arrays. See arrays
attitudes toward, 3–16, 283
classes
encapsulation of, 195–196
event handlers and, 196–197, 198
Implements keyword and, 200–201
validation of, 93
variants and, 52–53
code format
indentations, 178–180
line continuation, 116–117
parentheses, 108
spacing, 110–111
syntax, 157
code review process, 278, 280–281, 290–292
code uniformity and simplicity, 173–174, 175
comment files and, 129–143, 389–390
constants, 61–71, 75–77, 238
controls, 117, 202, 245–247, 256
conversion functions, 108
daily schedule for, 333–334
data types. See data types
debug and nondebug code, separating, 187–188
distractions during, 30–31
duplicate code, 204, 209–210
encapsulation and, 195–214
enhancements, addition of, 174–175
enumerated values, 61–71
error handling. See error handling
example program code. See example program code
fixing own code, 292
keyboard shortcuts, 289
objects, 196–197, 245–247, 282
offensive vs. defensive, 11–12
operators, correct use of, 107–108
optimizations, 177–178, 215–225
order of actions in, 119–120
parameters. See parameters
prepackaged tools and, 175–177
profiling code. See Visual Basic Code Profiler (VBCP)
random behavior in code, 117–119
restrictions, adding coding, 85–86
separation of tasks during, 184–185
side effects in code, 103–105
standardization of code, 33–34
statements. See statements
testing code, 277–302
tricks for, 101–103
validation of
application results, 96–97
arguments, 73–77
classes, 93
data, 89–93
forms, 93
optional parameters, 78–80
ParamArray, 83–84
variables. See variables
variants and, 36, 50–53, 54–55
wizards for, 120–121
programming language syntax, 157
project management issues, 3–17
catching bugs in development, 5
control issues, 5–7
designing before coding, 24–29
documentation methods, 19–21, 22–23
optimization, deferring, 9–10
self-test, 15–16
properties, 117, 207–208
property procedure return types, 49, 198–199
Public statements, 113–114
public variables, 198
R
random behavior, limiting, 117–119
random number generators, 118–119
read-only values, 198
ReDim statements, 112
reference counting, automatic, 151–152, 197
reference loops, 151–152
references, circular, 151–152
Remove Array Bounds Checks option, 220
Remove Integer Floating-Point Error Checks option, 221–222
Remove Integer Overflow Checks option, 221
Remove Safe Pentium FDIV Checks, 223–224
restrictions, adding to code, 85–86
result verification, automatic, 96–97
Resume Next statements, 233–234
Resume statement, 159–160, 231
Resume statements, 231, 232–233
reviews, code, 278, 280–281, 290–292
Rnd statements, 117, 118–119
RoutineInfo class, 260
routines. See also subroutines
ByRef keyword, 114–115
ByVal keyword, 114–115
calculations, eliminating, 154–155
debugging habits and, 319
encapsulating, 195–196
error handling and
cleaning up after, 243–245
encapsulation of errors, 205–206
error status code, 182–183
preparing for unexpected, 242–243
stack trace messages, 258–265
exiting from, 161–163
files in, opening and closing, 109–110
header comments for, 134–136, 390–391
naming issues, 121–122
side effects and, 103–105
static, 112–113
user actions, simulating, 292–295
values, verification of, 155–156
writing test, 283–284
S
scope
error handling and, 240
Hungarian notation and, 40, 41
limiting, 46
Private statements, 113–114
Public statements, 113–114
testing different levels of, 278–279
variable name conflicts and, 45–46
Select statements, 120, 185, 289
self-tests
Bad1, 15–16, 329–332
Bad10, 211–213, 365–370
Bad11, 224–225, 370–372
Bad12, 221–222, 249–251
Bad13, 272–274, 378–382
Bad15, 311–312, 383–384
Bad16, 324–326, 385–386
Bad3, 58–59, 334–338
Bad4, 69–71, 338–341
Bad5, 97–99, 341–346
Bad6, 124–126, 346–350
Bad8, 167–169, 355–358
Bad9, 189–193, 358–365
comment files, 141–142, 347–351
testing application code, 300–301, 382–383
SetDebugMode subroutine, 77
shortcuts. See tricks, coding
ShowErrorMessage function, 257–258
shutdown, data validation at, 90–91
side effects, 103–105
stack trace messages, 258–265
StackDump program, 259–265
standardization of coding syntax, 33–34, 121–122
startup, data validation at, 90–91
statements
With, 208–209
Debug.Assert, 74–75, 88, 180, 181
decision making by, 289
DefBool, 39
DefInt, 39
DefLng, 39
Deftype, 33, 39–40
Dim, 113–114
DoEvents, 90–91
Else, 68, 95–96
End, 155–156
End Function, 231, 235
End Property, 231, 235
End Sub, 231, 235
On Error GoTo, 159–160, 185
On Error GoTo 0, 229, 230
On Error GoTo line, 229, 231
On Error Resume Next, 229, 230
Err.Raise, 181, 231, 235–238
Exit, 155–156, 185
Exit Function, 231, 234–235
Exit Property, 231, 234–235
Exit Sub, 161–162, 231, 234–235
GoTo, 157–161
If, 75–77, 119–120, 185, 289
If Then Else, 68, 185
IIF, 163–164
nested, 208–209
Next, 123–124
Option Explicit, 37–38
Private, 113–114
Public, 113–114
ReDim, 112
Resume, 159–160, 231, 232–233
Resume Next, 231, 233–234
Rnd, 117, 118–119
Select, 120, 185, 289
Stop, 75–77, 88, 180, 181
Then Else, 163–164
TypeName, 49–50
TypeOf, 49–50
Unload, 94–95
static routines, 112–113
static variables, 47, 112–113
statistics, VCBE, 306–311
Function Hit Count, 307, 310
Function Timing, 307, 309
Line Hit Count, 307, 309–310
Line Timing, 307–308
status codes, defining, 182
step through test method, 278, 279–280
Stop statements
argument verification, 75–77, 88, 180
invalid situations and, 181
strings, 107, 109
subroutines. See also routines
code, indenting text of, 178–180
data validation and, 89–90
encapsulation with, 203–204
error handling and
cleaning up after, 243–245
preparing for unexpected, 242–243
stack trace messages, 258–265
exiting from, 161–163
header comments for, 134–136
Immediate window, testing in, 286
user actions, simulating, 292–295
subtype functions, variant, 54–55
system-global objects, 282
T
tasks, separation of programming, 184–185
templates
header comments, 387–389
for event handlers, 137, 389
for routines and functions, 135–136, 388–389
MyForm, 55–58
testers, use of separate, 290–292
testing code, 277–302. See also Visual Basic Code Profiler (VBCP)
anticipating results of, 290
black box method, 278, 281
code review method, 278, 280–281
code step through method, 278, 279–280
code walkthrough method, 278
with dummy routines, 297–298
errors
analysis and documentation of, 298–299
estimating finding time, 296–297
estimating numbers of, 295–296
faking during tests, 290
global variables and, 282
input checking method, 278, 281
planning of tests, 283
platform compatibility, 285–286
scope and, 278–279
self-tests, 300–301, 383–384
test routines, writing, 283–284
user actions, simulating, 292–295, 297–298
white box method, 278, 282
text format, code
comment files and, 139–140
indentations in, 178–180
line continuation, 116–117
line spacing, 110–111
parentheses, 108
syntax, 157
TextBox control, 43
Then Else statement, 163–164
tools, prepackaged, 175–176
tricks, coding, 101–103
TypeName statements, 49–50
TypeOf statements, 49–50
types, data
Hungarian notation and, 41
mixing of, 105–106
nonspecific, 49–50
selecting variable, 48–49
user-defined (UDTs), 201–202
variants, 50–55
U
UBound function, 65–66, 86–89, 180
UDTs (user-defined types), 201–202
underflow errors, 164–165
Unload statement, 94–95
user actions, 292–295
user-defined types (UDTs), 201–202
user interface, 297–298
V
validating
arguments, 73–77
classes, 93
data, 89–93
forms, 93
optional parameters, 78–80
ParamArray, 83–84
results, 96–97
values
floating-point calculations, 221–222
property, saving, 207–208
read-only, 198
variable, assigning, 167
variables, 35–60
argument promotion and, 165–166
assigning values to, 167
Bad3 example code, 58–59, 335–338
data types
mixing of, 105–106
nonspecific, 49–50
selecting, 48–49
user-defined (UDTs), 201–202
date and time, 149–150
declaration of
automatic, 37–38
explicit, 36, 48–49
Deftype statements and, 33, 39–40
encapsulation with, 206–207
forms and, 55–58
global, 47, 282
Hungarian notation and, 40–44
Immediate window and, 286–288
initialization of, 154
input, 183–184
looping of, 122–124
module-global, 46, 47, 282
multiple, 36, 45–46
multipurpose, 183–184
naming issues, 40–46, 121–124
Option Explicit statements, 37–38
output, 184, 290
public, 198
reuse of, 122–123, 154–155
scope of, 45–46, 113–114
sharing, 187–188
sizing of, 167
static, 47, 112–113
unused, clearing, 94–95
variants and, 36, 50–55
variants, 36, 50–53
functions and, 109
ParamArray parameters and, 83
subtype functions and, 54–55
VBCP (Visual Basic Code Profiler). See Visual Basic Code Profiler (VBCP)
vbObjectError constant, 238
Visual Basic
Application Performance Explorer (APE), 304
break options in, 248
Code Profiler. See Visual Basic Code Profiler (VBCP)
debugger in, 279–280
optimization options, 218–224
Allow Unrounded Floating-Point operations, 222–223
array bounds checks, 218
Assume No Aliasing, 219–220
Remove Array Bounds Checks, 220
Remove Integer Floating-Point Error Checks, 221–222
Remove Integer Overflow Checks, 221
Remove Safe Pentium FDIV Checks, 223–224
Visual Data Manager, 269–279
WindowProc, 294–295
Visual Basic Code Profiler (VBCP), 295, 303–313
code coverage, checking, 295
debugging habits and, 315–327
installation of, 303–304
instructions for, 306–307
methodology of, 305
optimization and, 216–217
results, analyzing, 307–311
self-test, 311–312, 383–384
Visual Data Manager, 269–279
W
Watch windows, 286–288
While loops, 148, 149–150, 289
white box testing method, 278, 282
WindowProc, 294–295
With statements, 208–209
wizards, coding, 120–121
work habits, 19–32. See also development process
bug logs, 20–21
daily schedules, 333–334
distractions, minimizing, 30–31
notebooks, 19–20
saving materials, 21–22
Z
zero, division by, 165, 221–222


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-1999 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permision of EarthWeb is prohibited.